package miniBanco.Gui;

import java.awt.Color;
import java.util.ArrayList;

import javax.swing.JButton;
import javax.swing.JPanel;
import javax.swing.JSeparator;
import miniBanco.Dto.CuentaDTO;
import MySwing.JMyGridABM;

public class CuentasGridAbm extends JPanel 
{
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private ArrayList<CuentaDTO> data;
	private JMyGridABM grid;
	private CuentasTableModel model;
	private JButton btnVolver;
	public CuentasGridAbm()
	{
		model = new CuentasTableModel(data);
		grid = new JMyGridABM(model);
		btnVolver = new JButton("Volver");
		btnVolver.setBackground(Color.red);
		add(grid);
		add(new JSeparator());
		add(btnVolver);
	}
	public CuentasGridAbm(ArrayList<CuentaDTO> data)
	{
		this();
		this.data = data;
	}
	public void Refresh(ArrayList<CuentaDTO> data)
	{
		this.data = data;
		model = new CuentasTableModel(data);
		this.grid.Refresh(model);
	}
	public JMyGridABM getGrid()
	{
		return grid;
	}
	public JButton getBtnVoler()
	{
		return btnVolver;
	}
	public ArrayList<CuentaDTO> getData()
	{
		return data;
	}
}